﻿<!doctype html>
<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">
    <meta content="email=no" name="format-detection">
    <title>address</title>
	<meta name="keywords" content="" />
	<meta name="description" content="" />
    <style type="text/css">
    * {
        margin: 0;
        padding: 0;
        -webkit-appearance: none; //去掉浏览器默认样式
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        -webkit-touch-callout: none;
        box-sizing: border-box;
    }
    
    html,
    body {
        margin: 0 auto;
        width: 100%;
        min-height: 100%;
        overflow-x: hidden;
        -webkit-user-select: none;
    }
    
    body {
        font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
        -webkit-text-size-adjust: 100%; //关闭自动调整字体
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
        background: rgb(247,247,247);
    }
    
    input {
        width: 100%;
        height: 60px;
        font-size: 15px;
        border:none;
        border-bottom: 1px solid rgb(247,247,247);
        padding: 5px;
        padding-left: 10px;
    }
    
    
    textarea{
    	width: 100%;
    	height: 100px;
    	resize: none;
    	padding: 10px;
    	font-size: 14px;
    	border:none;
        border-bottom: 1px solid rgb(247,247,247);
    }
    .done{
    	width: 250px;
    	height: 40px;
    	background: #6db0ff;
    	color: white;
    	letter-spacing: 4px;
    	font-size: 16px;
    	margin: auto;
    	border-radius: 5px;
    	text-align: center;
    	line-height: 40px;
    	margin-top: 19px;
    }
    
    </style>
    <link rel="stylesheet" href="css/LArea.css">
</head>

<body>
    <div>
        <div class="content-block">
        	<input type="text" name="name" id="name" value="" placeholder="收货人" />
        	<input type="text" id="phoneNumber" value="" placeholder="联系电话"/>
            <input id="demo1" type="text" readonly="" placeholder="所在地区(获得现金奖用户可不填)"/>
            <input id="value1" type="hidden" value="20,234,504"/>
            <textarea id="deplace" name="" rows="" cols="" placeholder="请填写详细地址，不少于5个字(获得现金奖用户可不填)"></textarea>
        </div>
        <div class="done">
        	完成
        </div>
    </div>
    <script src="js/LAreaData1.js"></script>
    <script src="js/LAreaData2.js"></script>
    <script src="js/LArea.js"></script>
    <script type="text/javascript" src="js/jquery-1.9.1.min.js">
    	
    </script>
    <script>
    var area1 = new LArea();
    area1.init({
        'trigger': '#demo1', //触发选择控件的文本框，同时选择完毕后name属性输出到该位置
        'valueTo': '#value1', //选择完毕后id属性输出到该位置
        'keys': {
            id: 'id',
            name: 'name'
        }, //绑定数据源相关字段 id对应valueTo的value属性输出 name对应trigger的value属性输出
        'type': 1, //数据源类型
        'data': LAreaData //数据源
    });
    	
    	var u = navigator.userAgent;
		var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
		var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端

    	
    	var recordid = document.URL.split("?")[1].split("&")[0].split("=")[1];
    	console.log(recordid);
    	var leiClass = document.URL.split("?")[1].split("&")[1].split("=")[1];
    	console.log(leiClass);
    	var userid = document.URL.split("?")[1].split("&")[2].split("=")[1];
    	$(".done").on("touchend",function(){
    		console.log($("#deplace").val());
    		var Name = $("#name").val();
    		var phoneNum = $("#phoneNumber").val();
    		var place = $("#demo1").val();
    		var deplace = $("#deplace").val();
    		
    		
    		$.ajax({
				url: 'http://192.168.199.129:81/Activity/setAddress', //跨域到http://www.wp.com，另，http://test.com也算跨域
		        type: 'post', //jsonp 类型下只能使用GET,不能用POST,这里不写默认为GET
		        dataType: 'json', //指定为jsonp类型
		        data: { //数据参数
		            "userid": userid,
		            "account":Name,
		            "phone":phoneNum,
		            "address":place,
		            "detail":deplace,
		            "recordid":recordid,
		            "class":leiClass
		        },
				success:function(data){
					console.log(data);
					if(isiOS){
						window.webkit.messageHandlers.openSecret.postClose("1");//ios显示头像信息
					}else{
						window.AndroidWebView.AndpostClose("1"); //发送
					}	
					window.history.go(-1);
				}
			});
    	});
		
    </script>
</body>

</html>
